package com.qf.filter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

@WebFilter("*.action")
public class EncodingFilter implements Filter {
    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        //设置请求和响应的字符集
        request.setCharacterEncoding("utf-8");
        response.setCharacterEncoding("utf-8");
        //放行
        chain.doFilter(request,response);
    }
}
